# -*- coding: utf-8 -*-
"""
-------------------------------------------------
Project Name: luffcity study project
File Name: 函数作用域.py
Author: kij
Create Date: 2021/2/13
-------------------------------------------------
"""

# LEGB
# built
# input = 111
# global
# def fun1():
# 	def fun2():
# 		# input = 222 encloseing
# 		def fun3():
# 			# input = 333 local
# 			print(input)
# 		fun3()
# 	fun2()
# fun1()

# x = 111
#
# def func():
# 	# global x
# 	x = 222
#
#
# func()
# print(x)


x = 111
def fun1():
	def fun2():
		x = 222
		def fun3():
			nonlocal x
			x = 333
		fun3()
		print(x)
	fun2()
fun1()